<!DOCTYPE html>
<!--
     SPDX-License-Identifier: CC-BY-SA-4.0
     SPDX-FileCopyrightText: 2020 seL4 Project a Series of LF Projects, LLC.
-->
<!-- Page last generated 2025-02-20 03:16:15 +0000 -->
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>sel4bench | seL4 docs</title>

    <!-- Our stylesheet and theme stylesheet.  Contains bootstrap. -->
    <link rel="stylesheet" href="/assets/css/style.css" type="text/css">
    <!-- Font awesome -->
    <link href="https://use.fontawesome.com/releases/v5.0.8/css/all.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
    <!-- Pygments syntax highlighting  -->
    <link rel="stylesheet" href="/assets/css/highlighting/trac.css" type="text/css">
    <link rel="icon" type="image/x-icon" href="/assets/favicon.ico"><script defer data-domain="docs.sel4.systems"
	    src="https://analytics.sel4.systems/js/script.js"></script></head>

  <body class="container-fluid">

    



<header>
  <ul class="row menu">
    <li class="col-xs-12 col-md-2" >
            <a href="https://sel4.systems" class="skip-icon">
              <img class="img-responsive" src="/assets/logo-text-white.svg" alt="seL4 logo" />
            </a>
    </li>
    <li class="col-xs-12 col-md-10 menu">
      <nav aria-label="Banner links">
        <h2><a href="/Resources" />Resources</h2>
        <h2><a href="/processes" />Contributing</a></h2>
        <h2><a href="/projects" />Projects</h2>
        <h2><a href="/Tutorials" />Tutorials</h2>
        <iframe title="DuckDuckGo search bar" src="https://duckduckgo.com/search.html?site=docs.sel4.systems&prefill=Search%20sel4.systems" style="overflow:hidden;margin-bottom:10px; padding:0;height:40px;float:right;border-width: 0px"></iframe>
      </nav>
    </li>
  </ul>
  <div class="clear"></div>
  
<div class="breadcrumbs bootstrap hidden-sm-down">
  <nav class="sel-breadcrumb" aria-label="Breadcrumb" >
    <ol class=" list-unstyled" vocab="http://schema.org/" typeof="BreadcrumbList">
      
      
        

        

        <li class="breadcrumb-item" property="itemListElement" typeof="ListItem">
            <a property="item" typeof="WebPage" href="/">
              <span property="name"><b>seL4 Docs</b></span>
            </a>
            <meta property="position" content="1" />
        </li>
      
        

        

        <li class="breadcrumb-item" property="itemListElement" typeof="ListItem">
            <a property="item" typeof="WebPage" href="/projects/">
              <span property="name"><b>Projects</b></span>
            </a>
            <meta property="position" content="2" />
        </li>
      
        

        
          <li class="breadcrumb-item" property="itemListElement" typeof="ListItem">
            <span property="name">sel4bench</span>
            <meta property="position" content="3" /></li>
          
    </ol>
  </nav>
  <nav class="sel-version" aria-label="Current Versions">
    <ol class="list-unstyled">
      <li class="list-unstyled text-right" style="margin-left:auto; padding:0rem 0rem;">
        Current versions:</li>
      <li class="list-unstyled text-right">
      <a href="/releases/sel4/13.0.0"><b>seL4-13.0.0</b></a></li>
      <li class="list-unstyled text-right">
      <a href="/releases/microkit/1.4.1"><b>microkit-1.4.1</b></a></li>
      <li class="list-unstyled text-right">
      <a href="/releases/camkes/camkes-3.11.0"><b>camkes-3.11.0</b></a></li>
      <li class="list-unstyled text-right">
      <a href="/releases/capdl/0.3.0"><b>capDL-0.3.0</b></a></li>
      </ol>
  </nav>
  <div class='clear'></div>
</div>


</header>

    <main>
      <div class="row">
  <div class="hidden-xs col-sm-4 col-md-3 col-lg-2">
    


<div class="sidebar">















    <ul class="nav nav-sidebar">
  
    
    

    
        <li class="">
            <a class="" href="/projects/sel4/">seL4</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/l4v/">L4.verified</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/camkes/">CAmkES</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/capdl/">CapDL</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/elfloader/">Elfloader</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/buildsystem/">seL4 Buildsystem</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/user_libs/">user_libs</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/sel4runtime/">The seL4 run-time</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/sel4webserver/">seL4webserver</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/sel4-tutorials/">seL4 tutorials</a>
        </li>
  
    
    

    
        <li class="active">
            <a class="" href="/projects/sel4bench/">sel4bench</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/sel4test/">seL4Test</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/virtualization/">Virtualization</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/camkes-vm/">camkes-vm</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/dockerfiles/">Dockerfiles</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/docsite/">seL4 Documentation website</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/sel4_tools/">seL4_tools</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/microkit/">Microkit</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/hardware_hacks/">Hardware Hacks</a>
        </li>
  
    
    

    
        <li class="">
            <a class="" href="/projects/rust/">Rust</a>
        </li>
  
    </ul>


</div>

  </div>
  <div class="content col-sm-8 col-md-6 col-lg-7 main">
    
<!--
     Copyright 2017, Data61, CSIRO (ABN 41 687 119 230)

     SPDX-License-Identifier: BSD-2-Clause
-->
<h1 id="sel4bench">sel4bench</h1>

<p><em>sel4bench</em> is a benchmarking applications and support library for
<a href="https://sel4.systems/">seL4</a>.</p>

<p>To get this project, check out the <a href="https://github.com/seL4/sel4bench-manifest">project
manifest</a>.</p>

<h1 id="applications">Applications</h1>

<p>We provide multiple applications for benchmarking different paths in the
kernel.</p>

<h2 id="sel4bench-1">sel4bench</h2>

<p>This is the driver application: it launches each benchmark in a separate
process and collects, processes, and outputs results.</p>

<h2 id="ipc">ipc</h2>

<p>This is a hot-cache benchmark of the IPC path.</p>

<h2 id="irq">irq</h2>

<p>This is a hot-cache benchmark of the IRQ path, measured from inside the
kernel.  It requires
<a href="/BenchmarkingGuide.html#in-kernel-log-buffer">tracepoints</a>
to be placed on the IRQ path where the meaurements are to be taken from.</p>

<h2 id="irquser">irquser</h2>

<p>This is a hot-cache benchmark of the IRQ path, measured from user space.</p>

<h2 id="scheduler">scheduler</h2>

<p>This is a hot-cache benchmark of a scheduling decision.  It works by
using a producer/consumer pattern between two notification objects.
This benchmark also measures <code class="language-plaintext highlighter-rouge">seL4_Yield()</code>.</p>

<h2 id="signal">signal</h2>

<p>This is a hot-cache benchmark of the signal path in the kernel, measured
from user space.</p>

<h2 id="smp">smp</h2>

<p>This is an intra-core IPC round-trip benchmark to check overhead of
kernel synchronization on IPC throughput.</p>

<h2 id="vcpu-aarch64-only">vcpu <em>(AArch64 only)</em></h2>

<p>This benchmark will execute a thread as a VCPU (an EL1 guest kernel) and
then obtain numbers for the following actions:</p>
<ul>
  <li>Privilege escalation from EL1 to EL2 using the <code class="language-plaintext highlighter-rouge">HVC</code> instruction.</li>
  <li>Privilege de-escalation from EL2 to EL1 using the <code class="language-plaintext highlighter-rouge">ERET</code> instruction.</li>
  <li>The cost of a null invocation of the EL2 kernel using <code class="language-plaintext highlighter-rouge">HVC</code>.</li>
  <li>The cost of an <code class="language-plaintext highlighter-rouge">seL4_Call()</code> from an EL1 guest thread to a native seL4
thread.</li>
  <li>The cost of an <code class="language-plaintext highlighter-rouge">seL4_Reply()</code> from an seL4 native thread to an EL1
guest thread.</li>
</ul>

<p><em>Note:</em> In order to run this benchmark, you must notify the build system
that you wish to enable this benchmark by passing <code class="language-plaintext highlighter-rouge">-DVCPU=true</code> on the
command line, which will cause the kernel to be compiled to run in EL2.
You must also ensure that you pass <code class="language-plaintext highlighter-rouge">-DHARDWARE=false</code> to disable the
hardware tests.</p>

<p>Since this benchmark will cause the kernel image to be an EL2 image, it
will have an impact on the observed numbers for the other benchmark
applications as well, since they’ll be using an unexpected kernel build.</p>

<h1 id="adding-a-new-benchmark">Adding a new benchmark</h1>

<p>Contributing a new benchmark to seL4bench requires a few steps:</p>

<ul>
  <li>Under <code class="language-plaintext highlighter-rouge">apps</code>, create a directory for your new benchmark and:
    <ul>
      <li>Provide a <code class="language-plaintext highlighter-rouge">CMakelists.txt</code> file that defines a new executable.</li>
      <li>Provide a <code class="language-plaintext highlighter-rouge">src</code> folder that contains the source code for your
benchmark.</li>
    </ul>
  </li>
  <li>Under <code class="language-plaintext highlighter-rouge">apps/sel4bench</code>:
    <ul>
      <li>Update <code class="language-plaintext highlighter-rouge">CMakeLists.txt</code> to add your new benchmark to the list of
benchmarks.</li>
      <li>Under <code class="language-plaintext highlighter-rouge">src</code>:
        <ul>
          <li>Update <code class="language-plaintext highlighter-rouge">benchmark.h</code> to include your generated config for your benchmark, and provide a function declaration that will act as the entry point for your benchmark.</li>
          <li>Provide a <code class="language-plaintext highlighter-rouge">&lt;benchmark_name&gt;.c</code> file that implements the above function declaration. This function should return a <code class="language-plaintext highlighter-rouge">benchmark_t</code> struct. Construct this struct accordingly. The struct expects a function to process the results of the benchmark, which you should provide in this file as well</li>
          <li>Inside <code class="language-plaintext highlighter-rouge">main.c</code>, add your entry point function that was declared/defined above to the array of <code class="language-plaintext highlighter-rouge">benchmark_t</code> present.</li>
        </ul>
      </li>
    </ul>
  </li>
  <li>Update <code class="language-plaintext highlighter-rouge">easy-settings.cmake</code> to add your new benchmark. You can define here whether the benchmark should be enabled by default or not.</li>
  <li>Under <code class="language-plaintext highlighter-rouge">libsel4benchsupport/include</code>:
    <ul>
      <li>Provide a <code class="language-plaintext highlighter-rouge">&lt;benchmark_name.h&gt;</code> file that provides any extra definitions that your benchmark may need. You will also generally provide a <code class="language-plaintext highlighter-rouge">benchmark_name_results_t</code> struct here, which will be used to store the results of your benchmark when processing.</li>
    </ul>
  </li>
  <li>Update <code class="language-plaintext highlighter-rouge">settings.cmake</code> to include your new benchmark.</li>
</ul>

<p><em>File included from <a href="https://github.com/sel4/sel4bench/blob/master/README.md">github repo</a> <a href="https://github.com/sel4/sel4bench/edit/master/README.md">edit</a></em></p>


  </div>







  
  
<div class="sidebar-toc hidden-xs hidden-sm col-md-3 col-lg-3">
  
    <ul class="section-nav">
    	<h2> sel4bench </h2> 
        <li>
          
          <a style=" font-weight: bold; " class="" href="/projects/sel4bench/">
            Documentation homepage
          </a>
        </li>






        <li>
          
          <a style="" class="" href="/projects/sel4bench/status.html">
            Status
          </a>
        </li>












    
        <h3>Repositories</h3>
    
        <li>
          <a class="" href="https://github.com/seL4/sel4bench">
            sel4bench
          </a>
        </li>

    
        <li>
          <a class="" href="https://github.com/seL4/sel4bench-manifest">
            sel4bench-manifest
          </a>
        </li>









  







    
        <h3>Recent Updates</h3>
    
        <li>
          <a style="" href="/updates/sel4bench/11.0.x.html">
            seL4 11.0.x-compatible
          </a>
        </li>

    </ul>

</div>


</div>

    </main>
    


<footer class="site-footer">

  <h2 class="footer-heading">seL4 docs</h2>

  <div class="footer-col-wrapper">

    <div class="col-md-2">
      



<ul class="social-media-list">
  <li><a href="https://github.com/sel4"><i class="fab fa-github"></i> <span class="username">sel4</span></a></li><li><a href="https://github.com/sel4proj"><i class="fab fa-github"></i> <span class="username">sel4proj</span></a></li>
</ul>

    </div>

    <div class="col-md-8">
      <ul class="list-unstyled">
        <li>
          This site is for displaying seL4 related documentation.  Pull requests are welcome.
        </li>
        
          <li>
            Site last updated: Fri Feb 7 10:17:38 2025 +1100 ee78c8857c
          </li>
          <li>
                Page last updated: Mon Nov 30 09:25:37 2020 +1100 977ed44f17
          </li>
        
      </ul>
    </div>
    <div class="col-md-2">
<a href="https://github.com/seL4/docs/blob/master/projects/sel4bench/index.md">View page on GitHub</a>
      <br />
      <a href="https://github.com/seL4/docs/edit/master/projects/sel4bench/index.md">Edit page on GitHub</a>
      <br />
      <a href="/sitemap">Sitemap</a>
    </div>

  </div>

</footer>

  </body>
</html>
